<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
    <title>登录 - virus CMS后台管理系统</title>
    <link rel="shortcut icon" href="/static/admin/img/logo.jpg" type="image/x-icon">
    <link href="/static/admin/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/static/admin/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="/static/admin/css/weather-icons.min.css" rel="stylesheet"/>
    <link id="beyond-link" href="/static/admin/css/beyond.min.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="login-container">
    <div class="loginbox bg-white">
        <div class="loginbox-title">登录</div>

        <div class="loginbox-or">
            <div class="or-line"></div>
        </div>
        <form>
            <div class="loginbox-textbox">
                <input type="text" class="form-control" name="username" value="admin" placeholder="用户名"/>
            </div>
            <div class="loginbox-textbox">
                <input type="text" class="form-control" name="password" value="123456" placeholder="密码"/>
            </div>
            <div class="loginbox-forgot">
                <a href="">忘记密码?</a>
            </div>
            <div class="loginbox-submit">
                <button type="button" id="btnLogin" class="btn btn-primary btn-block">登录</button>
            </div>
            <div class="loginbox-signup">
                <a href="#">注册账户</a>
            </div>
        </form>
    </div>
</div>

<script src="/static/admin/js/skins.min.js"></script>
<!--Basic Scripts-->
<script src="/static/admin/js/jquery.min.js"></script>
<script src="/static/admin/js/bootstrap.min.js"></script>
<script src="/static/admin/js/slimscroll/jquery.slimscroll.min.js"></script>
<!--Beyond Scripts-->
<script src="/static/admin/js/beyond.js"></script>
<script src="/static/admin/js/toastr/toastr.js"></script>
<script>
    $(window).bind("load", function () {

        /*Sets Themed Colors Based on Themes*/
        themeprimary = getThemeColorFromCss('themeprimary');
        themesecondary = getThemeColorFromCss('themesecondary');
        themethirdcolor = getThemeColorFromCss('themethirdcolor');
        themefourthcolor = getThemeColorFromCss('themefourthcolor');
        themefifthcolor = getThemeColorFromCss('themefifthcolor');

    });

    $(function () {
        $("#btnLogin").click(function () {
            let url = '/admin/login/check';
            $.ajax({
                type: "POST",
                data: $('form').serialize(),
                dataType: 'json',
                url: url,
                success: (data) => {
                    if (data.code === 1) {
                        toastr.success(data.msg, "登录成功");
                        setTimeout(function () {
                            location.href = '/admin/index/index';
                        }, 1000);
                    } else {
                        toastr.error(data.msg);
                    }
                }
            })
        });
    });
</script>
</body>
<!--  /Body -->
</html>
